.icon-library {
  padding: 1rem;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.icon-library-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--p-border-subdued);
}

/* 自定义 ResourceList 样式 */
:global(.Polaris-ResourceList__Item) {
  cursor: grab;
  transition: all 0.2s ease;
  padding: 0.5rem;
  margin: 0.25rem 0;
  border-radius: 4px;
  user-select: none;
}

:global(.Polaris-ResourceList__Item:active) {
  cursor: grabbing;
}

:global(.Polaris-ResourceList__Item:hover) {
  background-color: var(--p-surface-hovered);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

:global(.Polaris-ResourceList__Item--selected) {
  background-color: var(--p-surface-selected);
}

/* 缩略图样式 */
:global(.Polaris-Thumbnail) {
  border-radius: 4px;
  overflow: hidden;
  width: 48px;
  height: 48px;
  margin-right: 1rem;
}

:global(.Polaris-Thumbnail img) {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-color: white;
}

/* 图标列表容器 */
:global(.Polaris-ResourceList) {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.5rem;
  max-height: calc(100vh - 200px); /* 减去头部和其他元素的高度 */
}

/* 滚动条样式 */
:global(.Polaris-ResourceList::-webkit-scrollbar) {
  width: 6px;
}

:global(.Polaris-ResourceList::-webkit-scrollbar-track) {
  background: var(--p-surface-subdued);
  border-radius: 3px;
}

:global(.Polaris-ResourceList::-webkit-scrollbar-thumb) {
  background: var(--p-border-subdued);
  border-radius: 3px;
}

:global(.Polaris-ResourceList::-webkit-scrollbar-thumb:hover) {
  background: var(--p-border);
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.icon-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  border: 1px solid #e1e3e5;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-item:hover {
  background-color: #f6f6f7;
  border-color: #8c9196;
}

.icon-item img {
  width: 32px;
  height: 32px;
  margin-bottom: 4px;
}

.icon-item span {
  font-size: 12px;
  text-align: center;
  color: #202223;
}

/* 确保图标项样式正确 */
.icon-library :global(.Polaris-ResourceItem) {
  cursor: grab;
  transition: all 0.2s ease;
  user-select: none;
}

.icon-library :global(.Polaris-ResourceItem:hover) {
  background-color: var(--p-surface-hovered);
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 拖拽时的样式 */
.icon-library :global(.Polaris-ResourceItem:active) {
  cursor: grabbing;
  transform: scale(0.98);
} 